function foo(){
    /*点击后跳到页面*/
    window.open("moban.html");
}
function jisuan(){
    reader();
    /*调用生成的二维码方法*/
    erweima();
}
function erweima(){
    var mode=!!document.createElement('canvas').getContext?'canvas':'table';
    var xyz=document.getElementById('zhucehao').getElementsByTagName('span');
    var xxx=window.opener.document.getElementById('table').getElementsByTagName('input');
    var str1="名称："+xxx[1].value+"  ";
    var str2="注册号："+xxx[0].value+"  ";
    var str3="类型："+xxx[2].value+"  ";
    var str4="住所："+xxx[3].value+"  ";
    var str5="法定代表人："+xxx[4].value+"  ";
    var str6="注册资本："+xxx[5].value+"  ";
    var str7="成立日期："+xxx[6].value+"年"+xxx[7].value+"月"+xxx[8].value+"日"+"  ";
    var str8="营业期限："+xxx[9].value+"  ";
    var str9="经营范围："+xxx[10].value+"  ";
    var str10="登记机关："+xxx[11].value+"  ";
    var str11="核准日期："+xxx[6].value+"年"+xxx[7].value+"月"+xxx[8].value+"日"+"  ";
    var str12="企业信用信息公示系统网址：http://gsxt.hnaic.gov.cn"+"  ";
    var str=str1+str2+str3+str4+str5+str6+str7+str8+str9+str10+str11+str12;
    jQuery('#erweima').qrcode({render:mode,text:utf16to8(str),width:100,height:100});
}
function reader(){
    var xxx=window.opener.document.getElementById('table').getElementsByTagName('input');
    /*注册号*/
    var zhucehao=document.getElementById('zhucehao').getElementsByTagName('span');
    /*信息*/
    var xinxi=document.getElementById('xinxi').getElementsByTagName('td');
    /*日期*/
    var riqi=document.getElementById('riqi').getElementsByTagName('span');
    zhucehao[0].innerHTML=xxx[0].value;
    xinxi[1].innerHTML=xxx[1].value;
    xinxi[3].innerHTML=xxx[2].value;
    xinxi[5].innerHTML=xxx[3].value;
    xinxi[7].innerHTML=xxx[4].value;
    xinxi[9].innerHTML=xxx[5].value;
    xinxi[11].innerHTML=xxx[6].value+"年"+xxx[7].value+"月"+xxx[8].value+"日";
    xinxi[13].innerHTML=xxx[9].value;
    xinxi[15].innerHTML=xxx[10].value;
    riqi[0].innerHTML=xxx[6].value;
    riqi[1].innerHTML=xxx[7].value;
    riqi[2].innerHTML=xxx[8].value;
    document.getElementById('gongzhang').innerHTML="<canvas id='ceshi'></canvas>";
    if(document.getElementById("ceshi")){//则支持canvas
        jisuan1(xxx[11].value,180);
        document.getElementById('gongzhang').innerHTML=document.getElementById('yinzhang').innerHTML;
        document.getElementById('canvas').style.width="0px";
        document.getElementById('canvas').style.height="0px";
        document.getElementById('yinzhang').style.width="0px";
        document.getElementById('yinzhang').style.height="0px";
    }
    else{//则不支持canvas
        document.getElementById('gongzhang').innerHTML="<img src='/img/gongzhang.png'/>";
    }
}
function utf16to8(str){
    var out,i,len,c;out="";
    len=str.length;
    for(i=0;i<len;i++){
        c=str.charCodeAt(i);
        if((c>=0x0001)&&(c<=0x007F)){
            out+=str.charAt(i);
        }
        else if(c>0x07FF){
            out+=String.fromCharCode(0xE0|((c>>12)&0x0F));
            out+=String.fromCharCode(0x80|((c>>6)&0x3F));
            out+=String.fromCharCode(0x80|((c>>0)&0x3F));
        }
        else{
            out+=String.fromCharCode(0xC0|((c>>6)&0x1F));
            out+=String.fromCharCode(0x80|((c>>0)&0x3F));
        }
    }
    return out;
}